package com.example.yuanboot.common.msg;

/**
 * @author qingyan 2021-06-08
 */
public class ResponseUtils {

    public static <T> ObjectRestResponse<T> r(T data, IResultCode code) {
        ObjectRestResponse<Object> r = new ObjectRestResponse<>();
        r.setStatus(code.getCode());
        r.setMessage(code.getMessage());
        return r.data(data);
    }

    public static <T> ObjectRestResponse<T> f(IResultCode code) {
        ObjectRestResponse r = new ObjectRestResponse<>();
        r.setStatus(code.getCode());
        r.setMessage(code.getMessage());
        return r;
    }

    public static <T> ObjectRestResponse<T> f(String code,String messages) {
        ObjectRestResponse r = new ObjectRestResponse<>();
        r.setStatus(code);
        r.setMessage(messages);
        return r;
    }

}
